package com.jianz.campus_markets.controller;


import com.jianz.campus_markets.domain.ResponseResult;
import com.jianz.campus_markets.domain.dto.ProductDto;
import com.jianz.campus_markets.domain.entity.Collection;
import com.jianz.campus_markets.service.CollectionService;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jianz
 * @since 2023-12-28
 */
@RestController
@RequestMapping("/collection")
public class CollectionController {

    @Autowired
    private CollectionService collectionService;

    @PostMapping("/add")
    public ResponseResult addCollection(@RequestBody Collection collection) {

        return collectionService.addCollection(collection);
    }

    @GetMapping ("/get")
    public ResponseResult getCollection(int userId) {

        return collectionService.getCollection(userId);
    }

    @DeleteMapping("/delete")
    public ResponseResult deleteCollection(int userId,int productId) {

        return collectionService.deleteCollection(userId,productId);
    }

}

